package com.bw.core.utils;

import java.util.Calendar;
import java.util.Date;

/**
 * @author: 薛志彬
 * @date: 2021.03.23
 */
public class TimeUtil {

    //每期的前一周提醒
    public Date monthTimeUtil(Date dateTime,Integer num) {
        Calendar calendar2 = Calendar.getInstance();
        calendar2.setTime(dateTime);
        calendar2.add(Calendar.MONTH, num+1);
        calendar2.add(Calendar.DATE, -7);
        Date time = calendar2.getTime();
        return time;
    }

    public Date nextMonthTimeUtil(Date dateTime) {
        Calendar calendar2 = Calendar.getInstance();
        calendar2.setTime(dateTime);
        calendar2.add(Calendar.MONTH, 1);
        Date time = calendar2.getTime();
        return time;
    }

    //算逾期可用
    public Date endTimeUtil(Date dateTime,Integer mon) {
        Calendar calendar2 = Calendar.getInstance();
        calendar2.setTime(dateTime);
        calendar2.add(Calendar.MONTH, mon);

        Date time = calendar2.getTime();
        return time;
    }
    //算逾期可用
    public Date lastTimeUtil(Date dateTime) {
        Calendar calendar2 = Calendar.getInstance();
        calendar2.setTime(dateTime);
        calendar2.add(Calendar.DATE, -7);
        Date time = calendar2.getTime();
        return time;
    }

}
